# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=pinentry-ui
pkgver=1.2.0
pkgrel=0
pkgdesc="Graphical UI's for Pinentry"
url="https://www.gnupg.org/aegypten2/"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	gcr-dev
	gtk+2.0-dev
	libassuan-dev
	libcap-dev
	libgpg-error-dev
	libsecret-dev
	qt5-qtbase-dev
	"
subpackages="
	pinentry-gtk
	pinentry-gnome
	pinentry-qt
	"
source="https://gnupg.org/ftp/gcrypt/pinentry/pinentry-$pkgver.tar.bz2"
builddir="$srcdir/pinentry-$pkgver"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-pinentry-gtk \
		--enable-pinentry-gtk2 \
		--enable-pinentry-qt \
		--disable-pinentry-curses \
		--disable-fallback-curses \
		--enable-pinentry-gnome3 \
		--enable-libsecret
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	# created by post install scripts so we can override with other UI versions
	rm -f "$pkgdir"/usr/bin/pinentry
}

gtk() {
	install="$subpkgname.post-install $subpkgname.post-deinstall"

	amove usr/bin/pinentry-gtk*
}

gnome() {
	depends="gcr"
	install="$subpkgname.post-install $subpkgname.post-deinstall"

	amove usr/bin/pinentry-gnome3
}

qt() {
	install="$subpkgname.post-install $subpkgname.post-deinstall"

	amove usr/bin/pinentry-qt*
}

sha512sums="
19cea79aa3982d1f0d75220c8e24ca38d6c49475c6f4c5aa7101151b4690db23ed316096a4a411136e716ba4eb471f48f9b09556e5c9837533c2356b9b384b63  pinentry-1.2.0.tar.bz2
"
